#include "app_buffer.h"
#include <stdio.h>
#include <string.h>

int main(int argc, char const *argv[])
{
    //1 缓冲区的初始化
    app_buffer_t *buffer= app_buffer_init();

    //2 写入数据
    app_buffer_write(buffer,"hello world",strlen("hello world"));
    app_buffer_write(buffer,"hello atguigu",strlen("hello atguigu"));
    
    //3 读取数据
    char tmp_buff[100];
    int read_size= app_buffer_read(buffer,tmp_buff,100);
    printf(" read text = %.*s\n",read_size,tmp_buff);
    read_size= app_buffer_read(buffer,tmp_buff,100);
    printf(" read text = %.*s\n",read_size,tmp_buff);

    //4 释放内存
    app_buffer_destroy(buffer);
    return 0;
}
